import {Component, OnInit} from '@angular/core';
import {HomeService} from "../providers/service/home.service";


@Component({
  selector: 'app-header',
  template: `
    <header>
      <nav class="topnav" id="topnav">
        <a routerLink="/home">
            <span>首页</span>
            <span class="en">home</span>
        </a>
      </nav>
    </header>
  `,
})
export class HeaderComponent implements OnInit {
  navs:any;//顶部菜单
  constructor(
    private homeService:HomeService
  ) {
    this.navs=[];
  }

  ngOnInit() {
    this.getNavs();
  }

  getNavs(){
    this.homeService.getNavs()
      .subscribe(data=>{
        this.navs=data.result;
      })
  }

}
